Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
How to resolve "Failed to lookup view "list" in views directory".?

Here is my code,

const express = require("express");
const bodyParser = require("body-parser");

const app = express();
app.set("view engine", "ejs");

app.get("/", function(req, res){
    var today = new Date();
    var currDay =  today.getDay();
    var day = "";

    if(currDay == 0){
       day = "Sunday";
    }
    else if(currDay == 1){
        day = "Monday";
    }
    else if(currDay == 2){
        day = "Tuesday";
    }
    else if(currDay == 3){
        day = "Wednesday";
    }
    else if(currDay == 4){
        day = "Thrusday";
    }
    res.render('list', {todayDay : day});
});
 
app.listen(4000, function(){
    console.log("Hey, you are in port 4000");
});

I am watching angela yu's web dev course while I got stuck in the phase where the error is this.

Error: Failed to lookup view "list" in views directory "C:\Users\ASUS\Dropbox\PC\Desktop\To-do\views" at Function.render (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\application.js:597:17) at ServerResponse.render (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\response.js:1039:7) at C:\Users\ASUS\Dropbox\PC\Desktop\To-do\app.js:33:9 at Layer.handle [as handle_request] (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\router\route.js:144:13) at Route.dispatch (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\router\route.js:114:3) at Layer.handle [as handle_request] (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\router\layer.js:95:5) at C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\router\index.js:284:15 at Function.process_params (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\router\index.js:346:12) at next (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\router\index.js:280:10)

Please if anybody can help me out.?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

the list file must be in a directory called views and you need to add it to the app

const path = require('path')
app.set('views', path.join(__dirname, 'views'));

this error is telling that it cannot find the filed called list

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!